home *** CD-ROM | disk | FTP | other *** search
-
-
-
- Tk_CreateEventHandler(3T)k Library Procedures
-
-
-
- _________________________________________________________________
-
- NAME
- Tk_CreateEventHandler, Tk_DeleteEventHandler - associate
- procedure callback with an X event
-
- SYNOPSIS
- #include <tk.h>
-
- Tk_CreateEventHandler(_t_k_w_i_n, _m_a_s_k, _p_r_o_c, _c_l_i_e_n_t_D_a_t_a)
-
- Tk_DeleteEventHandler(_t_k_w_i_n, _m_a_s_k, _p_r_o_c, _c_l_i_e_n_t_D_a_t_a)
-
- ARGUMENTS
- Tk_Window _t_k_w_i_n (in) Token for window in
- which events may
- occur.
-
- unsigned long _m_a_s_k (in) Bit-mask of events
- (such as But-
- tonPressMask) for
- which _p_r_o_c should be
- called.
-
- Tk_EventProc *_p_r_o_c (in) Procedure to invoke
- whenever an event in
- _m_a_s_k occurs in the
- window given by
- _t_k_w_i_n.
-
- ClientData _c_l_i_e_n_t_D_a_t_a (in) Arbitrary one-word
- value to pass to
- _p_r_o_c.
- _________________________________________________________________
-
-
- DESCRIPTION
- Tk_CreateEventHandler arranges for _p_r_o_c to be invoked in the
- future whenever one of the event types specified by _m_a_s_k
- occurs in the window specified by _t_k_w_i_n. The callback to
- _p_r_o_c will be made by Tk_HandleEvent; this mechanism only
- works in programs that dispatch events through
- Tk_HandleEvent (or through other Tk procedures that call
- Tk_HandleEvent, such as Tk_DoOneEvent or Tk_MainLoop).
-
- _P_r_o_c should have arguments and result that match the type
- Tk_EventProc:
- typedef void Tk_EventProc(
- ClientData _c_l_i_e_n_t_D_a_t_a,
- XEvent *_e_v_e_n_t_P_t_r);
- The _c_l_i_e_n_t_D_a_t_a parameter to _p_r_o_c is a copy of the _c_l_i_e_n_t_D_a_t_a
- argument given to Tk_CreateEventHandler when the callback
-
-
-
- Tk 1
-
-
-
-
-
-
- Tk_CreateEventHandler(3T)k Library Procedures
-
-
-
- was created. Typically, _c_l_i_e_n_t_D_a_t_a points to a data struc-
- ture containing application-specific information about the
- window in which the event occurred. _E_v_e_n_t_P_t_r is a pointer
- to the X event, which will be one of the ones specified in
- the _m_a_s_k argument to Tk_CreateEventHandler.
-
- Tk_DeleteEventHandler may be called to delete a previously-
- created event handler: it deletes the first handler it
- finds that is associated with _t_k_w_i_n and matches the _m_a_s_k,
- _p_r_o_c, and _c_l_i_e_n_t_D_a_t_a arguments. If no such handler exists,
- then Tk_EventHandler returns without doing anything.
- Although Tk supports it, it's probably a bad idea to have
- more than one callback with the same _m_a_s_k, _p_r_o_c, and _c_l_i_e_n_t_-
- _D_a_t_a arguments. When a window is deleted all of its
- handlers will be deleted automatically; in this case there
- is no need to call Tk_DeleteEventHandler.
-
- If mutliple handlers are declared for the same type of X
- event on the same window, then the handlers will be invoked
- in the order they were created.
-
-
- KEYWORDS
- bind, callback, event, handler
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Tk 2
-
-
-
-